package controller;

import java.util.ArrayList;

import javax.faces.bean.ManagedBean;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

import model.Pizza;

@ManagedBean
public class CartController {

	
	private DataModel<Pizza> cartContainer;
	private ArrayList<Pizza> cart;
	

	public DataModel<Pizza> getCartContainer() {
		return cartContainer;
	}

	public void setCartContainer(DataModel<Pizza> cartContainer) {
		this.cartContainer = cartContainer;
	}
	
	public CartController() {
		cart = new ArrayList<Pizza>();
		cartContainer = new ListDataModel<Pizza>();
		cartContainer.setWrappedData(cart);
	}
	
	public void add(Pizza pizza){
		cart.add(pizza);
		cartContainer.setWrappedData(cart);
	}
	
	
}
